<template>
  <view class="outBox">
    <u-navbar leftText="我的订单" leftIconColor="#fff" :autoBack="false" bgColor="rgba(0, 0, 0, 0.6)">
      <view class="left-slot" slot="left">
        <text>{{ '我的订单' }}</text>
      </view>
    </u-navbar>
    <VideoBox>
      <template #content>
        <view class="content">
          <view class="items">
            <view class="item" v-for="item in dataList" @click="handleDetails(item)" :style="{
					backgroundImage:`url(${baseImgUrl}mine/bg3.png)`,
				}">
              <view class="left">
                <view class="top">
                  <view class="tag">
                    <text>桌号</text>
                  </view>
                  <text class="name">{{ item.counterNo }}</text>
                </view>
                <view class="bottom">
                  <text>下单时间：{{ item.createTime }}</text>
                </view>
              </view>
              <view class="right">
                <view class="price">
                  <text>¥{{ item.consumePrice }}</text>
                </view>
              </view>
            </view>
          </view>
        </view>
      </template>
    </VideoBox>
    <Tabbar :currentTab="2"></Tabbar>
    <userLogin ref="userLoginRef"/>
  </view>
</template>

<script>
import {
  getWXStatusHeight
} from '@/utils/index.js'
import Header from '../../components/header.vue';
import Tabbar from '../../components/tabbar.vue';

import {
  findMyCounterOrderListApi
} from '../../api/api';
import VideoBox from "@/components/VideoBox/index.vue";

export default {
  components: {
    VideoBox,
    Header,
    Tabbar
  },
  data() {
    return {
      // 胶囊的宽度
      videoUrl: this.$videoUrl,
      barWidth: 0,
      barHeight: 0,
      menuHeight: 0,
      dataList: [],
      userLoginRef: null,
      baseImgUrl: this.$baseImgUrl,

    }
  },
  onLoad() {
    let obj = getWXStatusHeight()
    this.barWidth = obj.barWidth + 3
    this.barHeight = obj.barHeight
    this.menuHeight = obj.menuHeight
    this.userLoginRef = this.$refs.userLoginRef
  },
  onShow() {
    this.doSomeSthingByLogin(this.userLoginRef, this.getDataList)
  },
  methods: {
    // 获取订单列表
    async getDataList() {
      const res = await findMyCounterOrderListApi()
      if (res.code == 200) {
        this.dataList = res.data
      }
    },
    // 查看详情
    handleDetails(item) {
      this.getnav("/pages/order/listDetails?id=" + item.id)
    },
  }
}
</script>

<style lang="scss" scoped>
.tag {
  width: 76rpx;
  height: 40rpx;
  background: #FF9A2E;
  border-radius: 14rpx;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 16rpx;

  text {
    font-weight: 400;
    font-size: 28rpx;
    color: #FFFFFF;
  }
}

.bgBox {
  width: 100vw;
  height: 100vh;
  position: fixed;
  z-index: 1;
  background: rgba(0, 0, 0, 0.6);
}

.items {
  margin-top: 30rpx;

  .item {
    display: flex;
    justify-content: space-between;
    padding: 40rpx;
    margin-bottom: 18rpx;
    box-sizing: border-box;
    background-size: 100% 100%;

    .right {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;

      .price {
        font-weight: 500;
        font-size: 36rpx;
        color: #FFFFFF;
        line-height: 36rpx;
        text-align: right;
        font-style: normal;
      }

      .top {
        margin-bottom: 34rpx;

        text {
          color: #E8EF89;
          font-size: 24rpx;
        }
      }

      .status {
        font-family: Microsoft YaHei, Microsoft YaHei;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 116rpx;
        height: 42rpx;
        background: #192A15;
        border-radius: 200rpx 200rpx 200rpx 200rpx;
        border: 2rpx solid #3ED060;

        text {
          font-weight: 400;
          font-size: 20rpx;
          color: #32F178;
        }
      }
    }

    .right2 {
      .top {
        text {
          font-weight: 500;
          font-size: 36rpx;
          color: #FFFFFF;
          line-height: 36rpx;
          text-align: right;
          font-style: normal;
        }
      }

      .status1 {
        border-color: #67E3FF;
        background: #153337;

        text {
          color: #67E3FF;
        }
      }

      .status2 {
        border-color: #414141;
        background: #282828;

        text {
          color: #414141;
        }
      }
    }

    .left {
      .top {
        display: flex;
        margin-bottom: 20rpx;

        .name {
          font-size: 32rpx;
          color: #FFFFFF;
        }

      }

      .bottom {
        font-size: 28rpx;
        color: #86909C;
        line-height: 28rpx;
        text-align: left;
        font-style: normal;

        .one {
          display: flex;
          align-items: center;
        }

        .tag {
          width: 76rpx;
          height: 40rpx;
          background: #0FC6C2;
          border-radius: 14rpx;
          display: flex;
          align-items: center;
          justify-content: center;
          margin-right: 16rpx;

          text {
            font-weight: 400;
            font-size: 28rpx;
            color: #FFFFFF;
          }
        }

        .tag2 {
          background: #FF9A2E;
        }
      }
    }
  }
}

.content {
  position: relative;
  z-index: 9;
  box-sizing: border-box;
  padding: 0 30rpx 200rpx;
}

.left-slot {
  color: #fff;

  image {
    width: 40rpx;
    margin-right: 30rpx;
  }
}

.outBox {
  background: rgba(0, 0, 0, 0.6);
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 38rpx;
  width: 100%;
  box-sizing: border-box;

  .name {
    color: #fff;
  }
}

video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* 确保视频填充整个容器，可能会裁剪视频 */
  position: fixed;
  bottom: 0;
  left: 0;
  z-index: 0;
}
</style>
